import jwt
from myproject.settings import SECRET_KEY
class Mjwt():
    def __init__(self):
        self.secret = SECRET_KEY

    def jwt_encode(self,data):
        return jwt.encode(data,self.secret,algorithm="HS256")


    def jwt_decode(self,token):
        data = jwt.decode(token,self.secret,algorithms="HS256")
        return data

mjwt = Mjwt()
# import time
# data={"data":{"userid":1,'name':2,'exptime':int(time.time())}}
# token = mjwt.jwt_encode(data)
# print(token)
# mes = mjwt.jwt_decode(token)
# print(mes)
